//*************************************************************************
// File Name: Transaction.cpp
// This is the implementation file for the member functions
// of Class Transaction
// "Group 3"
// CS 1C
// March 25, 2010
// Group Project: SuperWarehouse
// Due: March 25, 2010
// - KZ's comment
//*************************************************************************

#include "Transaction.h"
#include "config.h"

//  protected class members
//	transDate
//	custID
//	itemName
//	unitPrice
//	quantity

Transaction::Transaction() :
		transDate(time_t(0)),
		custID(0),
		itemName(""),
		unitPrice(0.00),
		quantity(0) {
}

Transaction::Transaction(time_t date, int ID, string item,
		float price, int qty) :
		transDate(date),
		custID(ID),
		itemName(item),
		unitPrice(price),
		quantity(qty) {
}

Transaction::~Transaction() {
}

void Transaction::setTransData() {
}

time_t Transaction::getTransDate() {
	return transDate;
}

string Transaction::getItemName() {
	return itemName;
}

int Transaction::getQty() {
	return quantity;
}

float Transaction::getPrice() {
	return unitPrice;
}

int Transaction::getCustID() {
	return custID;
}

bool Transaction::operator==(const Transaction &other) const {
	if (this->custID == other.custID
			&& this->itemName == other.itemName
			&& this->quantity == other.quantity
			&& this->transDate == other.transDate
			&& this->unitPrice == other.unitPrice) {
		return true;
	} else {
		return false;
	}
}

Transaction &Transaction::operator=(const Transaction &rhs) {
	if (this != &rhs) {
		this->transDate = rhs.transDate;
		this->custID = rhs.custID;
		this->itemName = rhs.itemName;
		this->quantity = rhs.quantity;
		this->unitPrice = rhs.unitPrice;
	}
	return *this;
}

